<?php $this->load->view('common/head');?>
<?php $this->load->view('common/navbar');?>
<div class="table-responsive" style="margin-top: 20px;">
<form class="form-inline" method="GET" name="query" id="query">
<input type="hidden" name="c" id="c" value="<?php echo $this->input->get('c') ?>">
<input type="hidden" name="m" id="m" value="<?php echo $this->input->get('m') ?>">
<input type="hidden" name="proId" id="proId" value="<?php echo $proData['proId'] ?>">
  <div class="form-group form-group-sm">
    <label for="area">地区:</label>
    <select class="form-control" id="area" name="area">
	  <option value="">请选择</option>
	</select>
  </div>
  <div class="form-group form-group-sm">
    <label for="region">大区:</label>
    <select class="form-control" id="region" name="region">
	  <option value="">请选择</option>
	</select>
  </div>
  <div class="form-group form-group-sm">
    <label for="province">省份:</label>
    <select class="form-control" id="province" name="province">
	  <option value="">请选择</option>
	</select>
  </div>
  <div class="form-group form-group-sm">
    <label for="city">城市:</label>
    <select class="form-control" id="city" name="city">
	  <option value="">请选择</option>
	</select>
  </div>
  <div class="form-group form-group-sm">
    <label for="storeId">专营店:</label>
    <select class="form-control" id="storeId" name="storeId">
	  <option value="">请选择</option>
	</select>
  </div>
  <div class="form-group form-group-sm">
    <label for="keyword">关键字：</label>
    <input type="text" class="form-control" name="keyword" id="keyword" value="<?=$keyword?>" placeholder="关键字">
  </div>
  <div class="form-group form-group-sm">
    <label for="year">所属年份：</label>
    <select class="form-control" id="year" name="year">
      <option value="">请选择</option>
    </select>
  </div>
  <div class="form-group form-group-sm">
    <label for="timeUnit">所属双月：</label>
    <select class="form-control" id="timeUnit" name="timeUnit">
      <option value="">请选择</option>
	</select>
  </div>
  <div class="form-group form-group-sm">
    <label for="timeUnit">所属周：</label>
    <select class="form-control" placeholder=".col-xs-4" id="weekNum" name="weekNum">
      <option value="">请选择</option>
  	</select>
  </div>
  <div class="form-group form-group-sm">
  	<button type="submit" class="btn btn-info btn-sm">搜索</button>
  </div>
</form>
</div>

<table class="table table-bordered table-condensed text-center" style="width: 400px; line-height: 20px;margin-top: 10px; margin-bottom: 20px;">
  <tbody>
    <tr style="line-height: 24px;">
      <td class="bg-primary" width="40%">来店量达成标准进度</td>
      <td class="bg-primary" width="60%"><?=$reachStandard?></td>
    </tr>
  </tbody>
</table>

<div>
<div style="width: 270px;float: left;">
<table class="table table-bordered table-condensed text-center">
  <thead align="center">
    <tr style="height: 125px;">
      <th rowspan="3">地区</th>
      <th rowspan="3">大区</th>
      <th rowspan="3">小区</th>
      <th rowspan="3">城市</th>
      <th rowspan="3">专营店名称</th>
      <th rowspan="3">专营店编码</th>
    </tr>
  </thead>
  <tbody>
  <?php foreach ($list as $k => $v): ?>
  	<tr align="center">
  	  <td><?=isset($allStoreList[$v['storeId']]) ? $allStoreList[$v['storeId']]['area'] : ''?></td>
	  <td><?=isset($allStoreList[$v['storeId']]) ? $allStoreList[$v['storeId']]['region'] : ''?></td>
  	  <td><?=isset($allStoreList[$v['storeId']]) ? $allStoreList[$v['storeId']]['spsarea'] : ''?></td>
  	  <td><?=isset($allStoreList[$v['storeId']]) ? $allStoreList[$v['storeId']]['city'] : ''?></td>
	  <td><?=isset($allStoreList[$v['storeId']]) ? $allStoreList[$v['storeId']]['storeName'] : ''?></td>
	  <td><?=isset($allStoreList[$v['storeId']]) ? $allStoreList[$v['storeId']]['coding'] : ''?></td>
  	</tr>
  <?php endforeach ?>
  </tbody>
</table>
</div>
<div style="width: 730px;float: right;" class="table-responsive">
<table class="table table-bordered table-condensed text-center" style="width: <?=count((array)$timeUnitData['weekList'])*730?>px;">
	<thead>
	  <tr>
	  	<th colspan="<?=count((array)$timeUnitData['weekList'])*7 +1?>">3-4月</th>
	  </tr>
	  <tr align="center" style="line-height: 40px;">
	  	<td rowspan="2">双月来店量目标</td>
	  	<?php foreach ((array)$timeUnitData['weekList'] as $weekK => $weekV): ?>
	  	<td colspan="7"><?=$weekV?></td>
	  	<?php endforeach ?>
	  </tr>
	  <tr align="center" style="line-height: 40px;">
	  	<?php foreach ((array)$timeUnitData['weekList'] as $weekK => $weekV): ?>
	  	<td>来店量实际</td>
	  	<td>来店量目标达成率</td>
	  	<td>提车实际</td>
	  	<td>提车达成</td>
	  	<td>交车实际</td>
	  	<td>交车达成</td>
	  	<td>转换率</td>
	  	<?php endforeach ?>
	  </tr>
	  </thead>
	<tbody>
		<?php foreach ($list as $k => $v): ?>
		<tr align="center">
			<td><?=$v['comeStoreTarget']?></td>
			<?php foreach ((array)$timeUnitData['weekList'] as $weekK => $weekV): ?>
			<td><?=isset($v['weekDataList'][$weekK]) ? $v['weekDataList'][$weekK]['comeStoreActual'] : ''?></td>
			<td><?=isset($v['weekDataList'][$weekK]) ? $v['weekDataList'][$weekK]['comeStoreRate'].'%' : ''?></td>
			<td><?=isset($v['weekDataList'][$weekK]) ? $v['weekDataList'][$weekK]['pickCarActual'] : ''?></td>
			<td><?=isset($v['weekDataList'][$weekK]) ? $v['weekDataList'][$weekK]['pickCarRate'].'%' : ''?></td>
			<td><?=isset($v['weekDataList'][$weekK]) ? $v['weekDataList'][$weekK]['deliveryActual']:''?></td>
			<td><?=isset($v['weekDataList'][$weekK]) ? $v['weekDataList'][$weekK]['deliveryRate'].'%' : ' '?></td>
			<td><?=isset($v['weekDataList'][$weekK]) ? $v['weekDataList'][$weekK]['transRate'].'%' : ''?></td>
			<?php endforeach ?>
		</tr>
		<?php endforeach ?>
	</tbody>
</table>
</div>
</div>
<!-- 分页 -->
<?=$pager?>
<div class="margin-top-30">&nbsp;</div>
<script type="text/javascript">
$(function(){
	loadPlaceList('area', 'area', '', '<?=$area?>');
	loadPlaceList('region', 'region', '<?=$area?>', '<?=$region?>');
	loadPlaceList('province', 'province', '<?=$region?>', '<?=$province?>');
	loadPlaceList('city', 'city', '<?=$province?>', '<?=$city?>');
	loadPlaceList('storeId', 'store', '<?=$city?>', '<?=$storeId?>');
    loadYearList('year',<?=$year ? $year : 0?>);
    loadTimeUnitList('timeUnit',<?=$year ? $year : 0?>,<?=$timeUnit ? $timeUnit : 0?>);
    loadWeekList('weekNum',<?=$year ? $year : 0?>,<?=$timeUnit ? $timeUnit : 0?>,<?=$weekNum ? $weekNum : 0?>);
});
	$("#year").change(function(){
	    loadTimeUnitList('timeUnit',this.value);
	    loadWeekList('weekNum',this.value,0);
	  });
	$("#timeUnit").change(function(){
	  loadWeekList('weekNum',$("#year").val(),this.value);
	});
	$('#area').change(function(){
		loadPlaceList('region', 'region', this.value, '');
		loadPlaceList('province', 'province', '', '');
		loadPlaceList('city', 'city', '', '');
		loadPlaceList('storeId', 'store', '', '');
	});
	$('#region').change(function(){
		loadPlaceList('province', 'province', this.value, '');
		loadPlaceList('city', 'city', '', '');
		loadPlaceList('storeId', 'store', '', '');
	});
	$('#province').change(function(){
		loadPlaceList('city', 'city', this.value, '');
		loadPlaceList('storeId', 'store', '', '');
	});
	$('#city').change(function(){
		loadPlaceList('storeId', 'store', this.value, '');
	});
</script>
<?php $this->load->view('common/foot');?>